!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jssPluginGlobal={},t.jss)}(this,(function(t,e){"use strict";function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var r="@global",s="@global ",o=function(){function t(t,s,o){for(var i in this.type="global",this.at=r,this.isProcessed=!1,this.key=t,this.options=o,this.rules=new e.RuleList(n({},o,{parent:this})),s)this.rules.add(i,s[i]);this.rules.process()}var s=t.prototype;return s.getRule=function(t){return this.rules.get(t)},s.addRule=function(t,e,n){var r=this.rules.add(t,e,n);return r&&this.options.jss.plugins.onProcessRule(r),r},s.replaceRule=function(t,e,n){var r=this.rules.replace(t,e,n);return r&&this.options.jss.plugins.onProcessRule(r),r},s.indexOf=function(t){return this.rules.indexOf(t)},s.toString=function(t){return this.rules.toString(t)},t}(),i=function(){function t(t,e,o){this.type="global",this.at=r,this.isProcessed=!1,this.key=t,this.options=o;var i=t.substr(s.length);this.rule=o.jss.createRule(i,e,n({},o,{parent:this}))}return t.prototype.toString=function(t){return this.rule?this.rule.toString(t):""},t}(),l=/\s*,\s*/g;function u(t,e){for(var n=t.split(l),r="",s=0;s<n.length;s++)r+=e+" "+n[s].trim(),n[s+1]&&(r+=", ");return r}t.default=function(){return{onCreateRule:function(t,e,n){if(!t)return null;if(t===r)return new o(t,e,n);if("@"===t[0]&&t.substr(0,s.length)===s)return new i(t,e,n);var l=n.parent;return l&&("global"===l.type||l.options.parent&&"global"===l.options.parent.type)&&(n.scoped=!1),n.selector||!1!==n.scoped||(n.selector=t),null},onProcessRule:function(t,e){"style"===t.type&&e&&(function(t,e){var s=t.options,o=t.style,i=o?o[r]:null;if(i){for(var l in i)e.addRule(l,i[l],n({},s,{selector:u(l,t.selector)}));delete o[r]}}(t,e),function(t,e){var s=t.options,o=t.style;for(var i in o)if("@"===i[0]&&i.substr(0,r.length)===r){var l=u(i.substr(r.length),t.selector);e.addRule(l,o[i],n({},s,{selector:l})),delete o[i]}}(t,e))}}},Object.defineProperty(t,"__esModule",{value:!0})}));
